import datetime

from sqlalchemy import Column, Integer, String, Float, DateTime, UniqueConstraint, Text

from QualityInspectionViolation.DbInit.mysqlDb import Base


class StayRoleSynchronization(Base):
    __tablename__ = 'role_synchronization'
    id = Column(Integer, primary_key=True)
    roleInfo = Column(Text)
    menuInfo = Column(Text)
    createdAt = Column(DateTime, default=datetime.datetime.now)
    updatedAt = Column(DateTime, default=datetime.datetime.now)

    def queryStayRoleSynchronization(self, stayRoleSynchronizationId, session):
        stayRoleSynchronization = session.query(StayRoleSynchronization). \
            filter(StayRoleSynchronization.id == stayRoleSynchronizationId).first()
        return stayRoleSynchronization